package com.app.view;

import java.awt.BorderLayout;
import java.awt.Toolkit;

import javax.swing.*;

import com.app.controller.FileManager;


@SuppressWarnings("javadoc")
public class Main {
	
	private static JFrame frame;
	private Toolkit toolKit;
	private Display displayFrame;
	private Search searchFrame;
	private Sort sortFrame;
	
	
	//Menu Bar
	private JMenuBar menuBar;
	private JMenu fileMenu;
	private JMenu editMenu;
	private JMenu sortMenu;
	
	public Main(){
		frame = new JFrame("Media Manager");
		this.toolKit = Toolkit.getDefaultToolkit();
		
		frame.setLocation(0,0);
		frame.setSize((int) this.toolKit.getScreenSize().getWidth(), (int) this.toolKit.getScreenSize().getHeight()-200);
		frame.setResizable(false);
		frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
		
		//create frames
		this.displayFrame = new Display();
		this.searchFrame = new Search();
		this.sortFrame = new Sort();
		
		//load ALL movies from file and add to Display.java GUI
		FileManager manage = new FileManager();
		manage.loadFromFile();
		this.displayFrame.setMovieList(manage.getList());
		
		
	}
	
	public void layoutGUI(){
		
		//create menu bar
		this.menuBar = new JMenuBar();
		this.fileMenu = new JMenu("File");
		this.editMenu = new JMenu("Edit");
		this.sortMenu = new JMenu("Sort");
		this.menuBar.add(this.fileMenu);
		this.menuBar.add(this.editMenu);
		this.menuBar.add(this.sortMenu);
		
		//add to main frame
		frame.add(this.menuBar, BorderLayout.NORTH);
	}
	
	public static void main(String [] args){
		Main display = new Main();
		display.layoutGUI();
		
		frame.setVisible(true);
	}
}
